<!-- <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../vue.global.js"></script>
</head>
<body>
    <div id="app"></div>
<script>
    Vue.createApp({
        data() {
            return {
                inputValue: "hello world...",
                list: ['hello', 'world', 'dell', 'lee']
            }
        },
        methods:{
            handleAddItem(){
                this.list.push(this.inputValue)
            }
        },
        template: `
          <div>
              <span>{{inputValue}}</span><br>
              <input v-model="inputValue"/>
              <button @click="handleAddItem">增加</button>
              <ul>
                <li v-for="(item,index) of list">{{ index }} - {{ item }}</li>
              </ul>
          </div>
        `
    }).mount("#app");
</script>
</body>
</html> -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.global.js" type="text/javascript"></script>
</head>
<body>
    <div id="id"></div>
    <script>
        let app = Vue.createApp({
            data(){
                return {
                    msg: 'Hello'
                }
            },
            mounted(){
             console.log(this.msg);
            },
            methods:{
                init(){
                    alert(this.msg)
                }
            },
            template:
            `
            <div>
                <button type="button" @click="init" style="width:200px;height:100px;background:red;border-radius:10px;color:white;">我的按钮</button>
            </div>
            `
        });
        app.mount("#id");
    </script>
</body>
</html>